<template>
  <a-dropdown :placement="placement" :trigger="trigger">
    <slot />
    <template #overlay>
      <a-menu>
        <a-menu-item
          :disabled="disabledIndex.includes(index)"
          v-for="(item, index) in list"
          :key="index"
          @click="item.click(tag)"
        >
          <template #icon v-if="item.icon">
            <vSvgIcon :name="item.icon" width="16px" height="16px"></vSvgIcon>
          </template>
          <span>{{ item.title }}</span>
        </a-menu-item>
      </a-menu>
    </template>
  </a-dropdown>
</template>

<script setup>
import vSvgIcon from "@/components/svgIcon/Index";
import { toRefs } from "vue";

const props = defineProps({
  placement: String,
  list: Array,
  trigger: {
    type: Array,
    default: () => ["hover"],
  },
  tag: Object,
  disabledIndex: {
    type: Array,
    default: () => [],
  },
});
const { placement, list, trigger, disabledIndex, tag } = toRefs(props);
</script>

<style lang="scss" scoped></style>
